package com.jie.demo.base;

import org.junit.FixMethodOrder;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runners.MethodSorters;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.hamcrest.core.CombinableMatcher.both;
import static org.junit.Assert.*;

/**
 * 包含一些小例子
 *
 * 测试执行顺序 （测试方法名字典顺序）
 * empty--》testA--》testAssertEquals--》testB--》testC
 */

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class BaseTest007 {

    @Test
    public void testAssertEquals() {
        assertEquals("failure - strings are not equal", "text", "text");
        assertSame(1,1);
        assertNotNull("should not be null", new Object());
        assertThat("albumen", both(containsString("a")).and(containsString("b")));
    }

    @Test
    public void testA() {
        System.out.println("first");
    }
    @Test
    public void testB() {
        System.out.println("second");
    }
    @Test
    public void testC() {
        System.out.println("third");
    }

    @Test
    public void testDate(){
        String responseString="color";
        assertThat(responseString, anyOf(containsString("color"), containsString("colour")));
    }

    @Ignore("Test is ignored as a demonstration")
    @Test
    public void testSame() {
        assertThat(1, is(1));
    }

}
